package com.etc.zmall.service.impl;

import java.util.List;

import com.etc.zmall.dao.AdminDao;
import com.etc.zmall.dao.impl.AdminDaoImpl;
import com.etc.zmall.entity.Admin;
import com.etc.zmall.service.AdminService;

/**
 * 
 * <p>
 * Title: AdminServiceImpl
 * </p>
 * 
 * <p>
 * Description:
 * </p>
 * 
 * @author knowno
 * 
 * @date 2021年1月11日
 * 
 */
public class AdminServiceImpl implements AdminService {
	AdminDao ad = new AdminDaoImpl();

	/**
	 * (non-Javadoc)
	 * 
	 * <p>
	 * Title: determineAdmin
	 * </p>
	 * 
	 * <p>
	 * Description: 判断帐号密码
	 * </p>
	 * 
	 * @param user
	 * @param pwd
	 * @return
	 * 
	 * @see com.etc.zmall.service.AdminService#DetermineAdmin(java.lang.String,
	 *      java.lang.String)
	 * 
	 */
	@Override
	public boolean determineAdmin(String user, String pwd) {
		Admin admin = ad.queryAdmin(user, pwd);
		if (admin == null) {
			return false;
		}
		return true;
	}

	// 删除管理员操作
	@Override
	public boolean delAdmin(String name) {
		return ad.delAdmin(name);
	}

	// 查询某一管理员
	@Override
	public Admin queryoneAdmin(String user) {
		List<Admin> list = ad.getAdmin(user);
		if (list.size() == 0) {
			return null;
		}
		return list.get(0);
	}

	// 修改密码
	@Override
	public boolean updateAdminpwd(String user, String pwd) {
		return ad.UpdataPwd(user, pwd);
	}

}
